package com.baeldung.bidirect;

import com.fasterxml.jackson.annotation.JsonView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dzy on 2018/9/2
 */
public class User3 {
  @JsonView(Views.Public.class)
  public int id;

  @JsonView(Views.Public.class)
  public String name;

  @JsonView(Views.Internal.class)
  public List<Item3> userItems = new ArrayList<>();;

  public User3(int id, String name) {
    this.id = id;
    this.name = name;
  }

  public void addItem(Item3 item) {
    userItems.add(item);
  }
}

class Views{
  public static class Public{}
  public static class Internal extends Public{}
}